﻿using System;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Messaging;

namespace DemoRealtimeData.ViewModel
{
    public sealed class DeviceViewModel : ViewModelBase
    {
        // ********************************************* //
        #region "notify-able properties"

        private bool _isSelected;
        public bool IsSelected
        {
            get { return _isSelected; }
            set
            {
                if (_isSelected == value) return;
                _isSelected = value;
                RaisePropertyChanged("IsSelected");
                Messenger.Default.Send(new DevSelectedChangedMsg(_name, _isSelected));
            }
        }

        private string _name;
        public string Name
        {
            get { return _name; }
            set
            {
                if (_name == value) return;
                _name = value;
                RaisePropertyChanged("Name");
            }
        }

        #endregion

        // ********************************************* //
        #region "constructor"

        public DeviceViewModel(string name)
        {
            Name = name;
            IsSelected = true;
        }

        #endregion

    }
}
